package com.goldman.oss.common.utils;

import org.apache.commons.lang3.StringUtils;

import java.io.File;


public class PathUtils {

    public static String addFileSeparatorIfNot(String path) {
        if (StringUtils.isBlank(path)) {
            return path;
        }
        if (!path.endsWith(File.separator)) {
            return path.concat(File.separator);
        }
        return path;
    }

    public static String removeFirstFileSeparatorIfExists(String path) {
        if (StringUtils.isBlank(path)) {
            return path;
        }
        if (path.startsWith(File.separator)) {
            return path.substring(1);
        }
        return path;
    }
}
